package com.firmboy.tool;

import com.firmboy.db.DBHelper;

import java.io.BufferedReader;
import java.io.FileReader;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

/**
 * 获取绝对路径的一个工具
 *
 * @author firmboy
 * @create 2018-04-28 上午10:09
 **/
public class PathTool {

    public static String path = "";

    static {
        URL resource = PathTool.class.getResource("/");
        path = resource.getPath();
        int target = path.lastIndexOf("target");
        path = path.substring(0, target);
        path=path+"src/main/java/";
        path = path.replace("%20","\\ ");
    }

    public  static String getPath(){
        return path;
    }

    public static String getPath(Class clas){
        String name = clas.getName();
        name = name.replace(".","/");
        int index = name.lastIndexOf("/");
        name  = name.substring(0,index+1);
        return path+name;
    }

}
